package com.michael.study.jetpack.application;

import com.michael.study.network.NetWorkModule;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Description:
 *
 * <p>Created by liuguoquan on 2020/8/5 20:18.
 */
public class Api extends NetWorkModule {

    private static volatile Api instance = null;

    public Api getInstance() {
        if (null == instance) {
            synchronized (Api.class) {
                if (null == instance) {
                    instance = new Api();
                }
            }
        }
        return instance;
    }

    @Override
    protected Interceptor getInterceptor() {
        return new Interceptor() {
            @NotNull
            @Override
            public Response intercept(@NotNull Chain chain) throws IOException {
                Request.Builder builder = chain.request().newBuilder();
                return chain.proceed(builder.build());
            }
        };
    }

    @Override
    public String getFactoryUrl() {
        return null;
    }

    @Override
    public String getTestUrl() {
        return null;
    }

    @Override
    public String getDevUrl() {
        return null;
    }
}
